﻿<UserControl x:Class="Blacklight.ShowCase.Samples.LiveSearchListBoxSample"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:controls="clr-namespace:Blacklight.Controls;assembly=Blacklight.Controls"
    >

    <UserControl.Resources>

        <DataTemplate x:Key="ImageTemplate">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <controls:OuterGlowBorder Margin="5" OuterGlowSize="5" OuterGlowColor="White" Background="Black" BorderThickness="1" BorderBrush="#ff999999" OuterGlowOpacity="0.3"
                                                      >
                    <Image Stretch="UniformToFill" Width="100" Height="100"
                              Source="{Binding Thumbnail.Url}" />
                </controls:OuterGlowBorder>

                <controls:WebLink Text="{Binding Title}" Grid.Column="1" Margin="5"
                                       Uri="{Binding Url}"
                                       TextWrapping="Wrap"
                                           FontWeight="Bold"
                                   />
            </Grid>

        </DataTemplate>

        <DataTemplate x:Key="WebTemplate">
            <Border BorderThickness="0,0,0,1" BorderBrush="#7f7f7f7f" Padding="0,5,0,5">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <controls:WebLink Text="{Binding Title}" 
                                       Uri="{Binding Url}"
                                       TextWrapping="Wrap"
                                           FontWeight="Bold"
                                   />

                    <TextBlock Text="{Binding Description}"
                                   Grid.Row="1"
                                   TextWrapping="Wrap"
                                   Opacity="0.6"
                                   />

                </Grid>
            </Border>
        </DataTemplate>

        <DataTemplate x:Key="NewsTemplate">
            <Border BorderThickness="0,0,0,1" BorderBrush="#7f7f7f7f" Padding="0,5,0,5">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <controls:WebLink Text="{Binding Title}" 
                                       Uri="{Binding Url}"
                                       TextWrapping="Wrap"
                                           FontWeight="Bold"
                                   />

                    <TextBlock Text="{Binding Snippet}"
                                   Grid.Row="1"
                                   TextWrapping="Wrap"
                                   Opacity="0.6"
                                   />

                </Grid>
            </Border>
        </DataTemplate>

        <controls:ResourceDictionaryManager x:Key="ResourceDictionaryManager">
            <controls:ResourceDictionaryManager.ResourceDictionaries>
                <controls:ResourceDictionaryCollection>

                    <controls:ResourceDictionary Path="/Blacklight.ShowCase;component/ResourceDictionaries/DavesGlossyControls.xaml">
                        <controls:ResourceDictionary.ResourceKeys>
                            <controls:ResourceKeyCollection>
                                <controls:ResourceKey ResourceName="GlossyBlackComboBox" />
                            </controls:ResourceKeyCollection>
                        </controls:ResourceDictionary.ResourceKeys>
                    </controls:ResourceDictionary>

                </controls:ResourceDictionaryCollection>
            </controls:ResourceDictionaryManager.ResourceDictionaries>
        </controls:ResourceDictionaryManager>

    </UserControl.Resources>

    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" MaxWidth="150" />
        </Grid.ColumnDefinitions>

        <TextBlock Foreground="#ffffffff" FontSize="14" FontFamily="Verdana" Margin="5" Text="Search Type" VerticalAlignment="Center" />
        <ComboBox Grid.Column="1" x:Name="searchTypeComboBox" Style="{StaticResource GlossyBlackComboBox}" MinWidth="150" Foreground="#ffffffff" VerticalAlignment="Center"
                  Margin="5" Height="25" HorizontalAlignment="Left" MaxWidth="150" />
        <TextBlock Foreground="#ffffffff" FontSize="12" FontFamily="Verdana" Margin="5" Grid.Row="0" Grid.Column="3" TextWrapping="Wrap"
                   Text="(The search type, here restricted to web, news and images.) " VerticalAlignment="Center" />


        <controls:ClippingBorder CornerRadius="10" Grid.Row="1" Grid.ColumnSpan="4" Margin="0,15,0,0">
            <controls:ClippingBorder.Background>
                <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                    <GradientStop Color="#ff333333" />
                    <GradientStop Color="#ff111111" Offset="1" />
                </LinearGradientBrush>
            </controls:ClippingBorder.Background>

            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>

                <StackPanel Orientation="Horizontal" Margin="5">
                    <TextBox x:Name="SearchText" Margin="0,0,5,0" FontSize="12" FontFamily="Verdana" MinWidth="250" />
                    <Button x:Name="SearchButton" Content="GO" Style="{StaticResource ButtonStyle}" Foreground="#ffffffff" />
                </StackPanel>

                <controls:LiveSearchListBox x:Name="LiveSearchListBox"
                                            AppId=""
                                            LiveSearchType="Web"
                                            TextBoxName="SearchText"
                                            SearchButtonName="SearchButton"
                                            FirstPageButtonName="FirstPageButton"
                                            PreviousPageButtonName="PreviousPageButton"
                                            NextPageButtonName="NextPageButton"
                                            Grid.Row="1"
                                            Margin="5"
                                            BorderBrush="#7fffffff"
                                            BorderThickness="0,1,0,1"
                                            />

                <StackPanel Orientation="Horizontal" Grid.Row="2" HorizontalAlignment="Right" Margin="5">
                    <Button x:Name="FirstPageButton" Content="|&lt;" Style="{StaticResource ButtonStyle}" Foreground="#ffffffff" />
                    <Button x:Name="PreviousPageButton" Content="&lt;" Style="{StaticResource ButtonStyle}" Foreground="#ffffffff" />
                    <Button x:Name="NextPageButton" Content="&gt;" Style="{StaticResource ButtonStyle}" Foreground="#ffffffff" />
                </StackPanel>
            </Grid>

        </controls:ClippingBorder>

    </Grid>
</UserControl>
